package com.xintoucloud.pbs.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.xintoucloud.pbs.dao.MenuDao_2;
import com.xintoucloud.pbs.entity.Menu_2;

@Repository
public class MenuDaoImpl_2 implements MenuDao_2 {
	@Autowired
	private SessionFactory sessionFactory;

	@SuppressWarnings("unchecked")
	public List<Menu_2> listMenuOnNullParentId() {
		return  sessionFactory.getCurrentSession().createQuery("from Menu_2 where parentId =?0").setParameter(0, 0).getResultList();
	}

	@SuppressWarnings("unchecked")
	public List<Menu_2> listMenusByParentId(Integer parentId) {
		return sessionFactory.getCurrentSession().createQuery("from Menu_2 where parentId =?0").setParameter(0, parentId).getResultList();
	}

	
}
